﻿
if col_length('Coupon', 'ProviderName') is null
begin
	alter table coupon add ProviderName varchar(50) null
end
go

if col_length('Coupon', 'CouponTypeId') is not null
Begin
	update Coupon 
	Set providerName = 'ShippingFree'
	where CouponTypeId = -3
End
Go

if col_length('Coupon', 'CouponTypeId') is not null
Begin
	update Coupon 
	Set providerName = 'VendorCode'
	where CouponTypeId = -1
End
Go

if col_length('Coupon', 'CouponTypeId') is not null
Begin
	update Coupon 
	Set providerName = 'GlobalDiscount'
	where CouponTypeId = -2
End
Go

alter table coupon alter column ProviderName varchar(50) not null
Go
